var util = require('util');

exports.callback = function(req, res) {
	server.Models.Device.update({
		hwAddress : req.params.device
	}, {
		status : 'offline',
		name : req.body.name,
		location : req.body.location,
		description : req.body.description
	}, function(e) {
		if (e)
			util.log(e.message + "\n" + e.stack);
	});
	res.redirect('https://' + req.header('X-Request-Host') + '/devices/' + req.params.device);
};

exports.path = '/devices/:device';
exports.method = 'post';
